package net.sourceforge.peertwitter.scamp.messaging;

import rice.p2p.commonapi.NodeHandle;


public class ForwardedJoinMessage extends ScampMessage {
	private JoinMessage joinMessage;
	private static final long serialVersionUID = -7457371685167719818L;
	private final int TTL;
	
	public ForwardedJoinMessage(JoinMessage jm, NodeHandle forwarder, int TTL) {
		super(jm.getGroup(), forwarder);
		this.joinMessage = jm;
		this.TTL = TTL;
	}

	public int getTTL() {
		return this.TTL;
	}
	
	@Override
	public boolean equals(Object obj) {
		return obj.getClass() == this.getClass() && super.equals(obj);
	}


	public JoinMessage getJoinMessage() {
		return this.joinMessage;
	}

	@Override
	public String toString() {
		return getTTL() + " ForwardedJoinMessage [joinMessage=" + joinMessage
				+ ", getSender()=" + getSender() + "]";
	}
	
//	@Override
//	public short getType() {
//		return ScampMessageTypes.FORWARDED_JOIN.type();
//	}
//
//	@Override
//	public void serialize(OutputBuffer buf) throws IOException {
//		// TODO Auto-generated method stub
//		
//	}

}
